<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>编辑菜单</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="__UI__/lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="__UI__/css/public.css" media="all">
    <style>
        body {
            background-color: #ffffff;
        }
    </style>
</head>
<body>
<div class="layui-form layuimini-form">
    <input type="hidden" name="id" value="{$row.id}">

    <div class="layui-form-item">
        <label class="layui-form-label required">标题</label>
        <div class="layui-input-block">
            <input type="text" name="not_title" lay-verify="required|datatime" lay-reqtext="标题不能为空" placeholder="请输入标题" value="{$row.not_title}" class="layui-input">

        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">内容</label>
        <div class="layui-input-block">
            <textarea name="not_con" class="layui-textarea">{$row.not_con}</textarea>

        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">发布时间</label>
        <div class="layui-input-block">
            <!--<input type="datetime" name="not_time" value="{$row.not_time}" lay-verify="required" lay-reqtext="发布时间不能为空" placeholder="请输入发布时间" class="layui-input">-->
            <input type="text" name="not_time" id="not_time" lay-verify="datetime"  value="{$row.not_time}" placeholder="yyyy-MM-dd HH:mm:ss" autocomplete="off" class="layui-input">
        </div>
    </div>
<!--    <div class="layui-form-item">-->
<!--        <label class="layui-form-label">图片</label>-->
<!--        <div class="layui-input-block">-->
<!--            <input type="text" name="not_pic"  placeholder="请输入照片" value="{$row.not_pic}" class="layui-input">-->
<!--        </div>-->
<!--    </div>-->

    <div class="layui-form-item">
        <label class="layui-form-label required">图片</label>
        <div class="layui-inline">
            <input type="hidden" name="not_pic" id="not_pic" placeholder="请选择图片" value="{$row.wor_pic}" class="layui-input" readonly>
            <!--<div id="uploadImg" class="zyupload"></div>-->
            <div class="layui-upload-drag" id ="uploadImg">
                <i class="layui-icon">&#xe67c;</i>
                <p>点击上传，或将文件拖拽到此处</p>
            </div>
        </div>
        <div class="layui-inline">
            <img id="img" src="/{$row.not_pic}" width="258" height="136">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">备注</label>
        <div class="layui-input-block">
            <textarea name="remark" class="layui-textarea">{$row.remark}</textarea>
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn">确认保存</button>
        </div>
    </div>
</div>
<script src="__UI__/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script src="__UI__/js/lay-config.js?v=1.0.4" charset="utf-8"></script>
<script src="__UI__/js/common.js" charset="utf-8"></script>
<script src="__UI__/lib/jquery-3.4.1/jquery-3.4.1.min.js" charset="utf-8"></script>
<script>
    layui.use(['form','upload','laydate'], function () {
        var form = layui.form,
            layer = layui.layer,
            iconPickerFa = layui.iconPickerFa,
            laydate = layui.laydate,
            upload = layui.upload,
            $ = layui.$;

        upload.render({
            elem: '#uploadImg',
            url: "{:url('admin/Uploader/uploadImg')}",  // 上传文件的路径
            done: function (res) {
                $('#img').attr('src','/'+res.data.src).show();
                $('#not_pic').val(res.data.src);
            }
        });

        //日期
        laydate.render({
            elem: '#not_time',
            type:'datetime',
            format: 'yyyy-MM-dd HH:mm:ss'
        });

        // iconPickerFa.render({
        //     elem: '#icon',
        //     url: "__UI__/lib/font-awesome-4.7.0/less/variables.less",
        //     limit: 12,
        //     search:true,
        //     click: function (data) {
        //         $('#icon').val('fa ' + data.icon);
        //     },
        //     success: function (d) {
        //         //console.log(d);
        //     }
        // });

        //监听提交
        form.on('submit(saveBtn)', function (data) {
            data = data.field;
            postSubmit(
                $,
                "{:url('admin/spnotice/edit')}",
                data,
                function (res) {
                    var iframeIndex = parent.layer.getFrameIndex(window.name);
                    parent.layer.close(iframeIndex);
                    parent.layui.table.reload('currentTableId');//刷新表格的数据
                },  //请求成功时的处理
                function () {} //请求错误时的处理
            );


            return false;
        });

    });
</script>
</body>
</html>